#pragma once
#include <iostream>
#include <string>
std::string opers = "+-*/%";
enum
{
    DivZero = 1,
    ModZero,
    UnKnown
};
class Task
{

public:
    Task(int x, int y, char op) : x_(x), y_(y), op_(op), result_(0), exitcode_(0)
    {
    }

    Task() : x_(0), y_(0), op_(0), result_(0), exitcode_(UnKnown)
    {
    }

    void Run()
    {
        switch (op_)
        {
        case '+':
            result_ = x_ + y_;
            break;
        case '-':
            result_ = x_ - y_;
            break;
        case '*':
            result_ = x_ * y_;
            break;
        case '/':
            if (y_ == 0)
            {
                exitcode_ = DivZero;
                return;
            }
            result_ = x_ / y_;
            break;
        case '%':
            if (y_ == 0)
            {
                exitcode_ = ModZero;
                return;
            }
            result_ = x_ % y_;
            break;
        default:
            break;
        }
    }

    void operator()()
    {
        Run();
        std::cout<<x_<<op_<<y_<<"="<<result_<<std::endl;
    }

public:
    int x_;
    int y_;
    char op_;
    int result_;
    int exitcode_;
};